import {BasicColumn, FormSchema} from '@/components/table';
import {render} from "@/hooks/render/renderUtils";
import {Api} from "./area.api";

export const columns: BasicColumn[] = [
  {
    title: '区域名称',
    dataIndex: 'areaName',
    align: 'left',
    width: 200,
  },
  {
    title: '编码',
    dataIndex: 'adCode',
    width: 200,
  },
  {
    title: '坐标',
    dataIndex: 'location',
    width: 200,
  },
  {
    title: '热门',
    dataIndex: 'hot',
    width: 80,
    renderApi: Api.setHot,
    rowKey: 'areaId',
    customRender: render.renderSwitch
  },
  {
    title: '启用',
    dataIndex: 'enabled',
    width: 200, 
    renderApi: Api.setState,
    rowKey: 'areaId',
    customRender: render.renderSwitch
    
  },
];

export const searchFormSchema: FormSchema[] = [];

export const formSchema: FormSchema[] = [
  {
    label: '区域名称',
    field: 'areaName',
    component: 'Input',
    required: true,
  },
  {
    label: '区域编码',
    field: 'areaCode',
    component: 'Input',
    required: true,
  },
  {
    label: '区域code',
    field: 'adCode',
    component: 'Input',
    required: true,
  },
  {
    label: '坐标',
    field: 'location',
    component: 'Input'
  },
  {
    label: '城市编码',
    field: 'cityCode',
    component: 'Input'
  }
];
